import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

    public class MyCallable implements Callable<String> {
        @Override
        public String call() throws Exception {
            for (int i = 0; i < 3; i++) {
                System.out.println("thread:" + i);
            }
            return "call!";
        }
        public static void main(String[] args) throws ExecutionException, InterruptedException {
            Callable callable = new Callable() {
                @Override
                public String call() throws Exception {
                    for (int i = 0; i < 3; i++) {
                        System.out.println("thread:" + i);
                    }
                    return "hhhh";
                }
            };
            FutureTask<String> futureTask = new FutureTask<>(callable);
            Thread thread = new Thread(futureTask);
            thread.start();
            for (int i = 0; i < 3; i++) {
                System.out.println("main:"+i);
            }
            System.out.println(futureTask.get());
        }
    }
